package com.baizhi.bzmall.admin.controller;

import com.baizhi.bzmall.common.vo.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("测试响应信息的一个控制器")
public class TestResutEntityController {
    @GetMapping("test")
    @ApiOperation("测试不带参数的方法，返回是一个错误信息")
    public ResultEntity<String> test(){
        return ResultEntity.error();//{code:500,msg:"error",data:""}
        // return ResultEntity.ok("携带的数据");
    }
    @GetMapping("test2/{msg}")
    @ApiOperation("测试带参数方法")
    public ResultEntity<String> test2(
            @ApiParam(value = "测试的参数",required = true)
            @PathVariable("msg") String msg){
        System.out.println(msg);
        // return ResultEntity.error();//{code:500,msg:"error",data:""}
        return ResultEntity.ok("携带的数据");
    }
}
